package ltd.hanamaki.study.demo01;

import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.net.MalformedURLException;
import java.net.URL;

public class AppiumTest01 {

    WebDriver driver;


    @BeforeClass
    public void setUP() {
        /* 首先 配置 需要打开的  软件的  配置信息 */
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("deviceName","127.0.0.1:62001");
        capabilities.setCapability("platformName","Android");
        capabilities.setCapability("appPackage","com.iBookStar.activityOff");
        capabilities.setCapability("appActivity", "com.iBookStar.activityOff.Splash");
        URL url = null;
        try {
            url = new URL("http://localhost:4723/wd/hub");
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }

        driver = new AndroidDriver<WebElement>(url, capabilities);

    }


    @Test
    public void test() {

        System.out.println("正常启动");

    }


    @AfterClass
    public void close() {

//        driver.quit();
        /* 在  appium 中 只能使用 quit 来退出  close  不能用 */

    }


}
